import React from "react";
import { NavLink, Routes, Route } from "react-router-dom";

import "./07-style.css";

const Home = () => {
  return <div>home组件</div>;
};

class About extends React.Component {
  render() {
    return <div>about组件</div>;
  }
}

const App = () => {
  return (
    <>
      <h3>router-v6-导航高亮</h3>
      <ul>
        <li>
          <NavLink
            to="/"
            className={({ isActive }) => {
              return isActive ? "select" : "";
            }}
          >
            home
          </NavLink>
        </li>
        <li>
          <NavLink
            to="/about"
            className={({ isActive }) => {
              return isActive ? "select" : "";
            }}
          >
            about
          </NavLink>
        </li>
      </ul>

      <hr />

      <Routes>
        <Route path="/" element={<Home />}></Route>
        <Route path="/about" element={<About />}></Route>
      </Routes>
    </>
  );
};

export default App;
